export type BigNumber = {
  numerator: bigint; // 分子（包含符号）
  denominator: bigint; // 分母（始终为正数）
};

// 运算符优先级映射
export const PRECEDENCE: Record<string, number> = {
  "+": 1,
  "-": 1,
  "*": 2,
  "/": 2,
  "^": 3,
  "(": 0,
  ")": 0,
};

export type TokenType =
  | "NUMBER"
  | "FUNCTION"
  | "("
  | "BINARY"
  | ")"
  | ","
  | "NUMARG";

export type Token = {
  type: TokenType;
  value?: string;
};

export type ASTNode = {
  name?: string;
  type: TokenType;
  operator?: string;
  value?: string;
  left?: ASTNode;
  right?: ASTNode;
  args?: ASTNode[];
  numArgs?: ASTNode[];
};
